package com.zhonggong.four;

import java.util.Random;
import java.util.Scanner;

public class HomeWork5 {
	
	public static void writeNumber() {
		
		int [] num1= new int [10];
		int [] num2= new int [10];
		int num3 = 0;
		Scanner in = new Scanner(System.in);
		for(int i=0;i<10;i++) {
			num1[i] = in.nextInt();
		}
		outer:
			for (int i = 0; i < 10; i++) {
				for(int j=0;j<10;j++) {
					if (num2[j]==num1[i]) {
						continue outer;
					}
				}
				num2[num3++]=num1[i];
			}
		for(int i=0;i<num3;i++) {
			System.out.print(num2[i]+"\t");
		}
	}
	
	public static void array2() {
		int [] num = new int [100];
		int [] count = new int [10];
		for(int i=0;i<100;i++) {
			num [i] = new Random().nextInt(10); 
		}
		for (int i : num) {
			count [i]++;
		}
		for (int i = 0; i < 10; i++) {
			System.out.println("count for  "+i+"  is  "+count[i]);
		}
	}
	
	public static void minIndex() {
		Scanner in = new Scanner(System.in);
		int [] number1= new int [10];
		for (int i = 0; i <10; i++) {
			number1[i]=in.nextInt();
		}
		int min = number1[0];
		int n = 0;
		for (int i = 0; i < number1.length; i++) {
			if (number1[i]<min) {
				min = number1[i];
				n = i;
			}
		}
		System.out.println("最小的数的是"+min+"下标是"+n);
	}
	
	public static void array4() {
		Scanner in = new Scanner(System.in);
		int [] [] array = new int [3] [3];
		for (int i = 0; i < array.length; i++) {
			for (int j = 0; j < array.length; j++) {
				array [i] [j] = in.nextInt();
			}
		}
		int sum = 0;
		for (int i = 0; i < array.length; i++) {
			for (int j = 0; j < array.length; j++) {
				if (i==j) {
					sum =sum+ array[i][j];
				}
			}
		}
		System.out.println(sum);
	}
	
	public static void addMatrix(int [] [] array1,int [] [] array2){
		array1 = new int [5] [5];
		array2 = new int [5] [5];
		int [] [] array3 = new int [5] [5];
		
		Scanner in = new Scanner(System.in);
		
		for (int i = 0; i < array1.length; i++) {
			for (int j = 0; j < array1.length; j++) {
				array1[i][j]=in.nextInt();
			}
		}
		
		for (int i = 0; i < array2.length; i++) {
			for (int j = 0; j < array2.length; j++) {
				array2[i][j]=in.nextInt();
			}
		}
		
		for (int i = 0; i < array3.length; i++) {
			for (int j = 0; j < array3.length; j++) {
				array3[i][j]=array1[i][j]+array2[i][j];
			}
		}
		
		int count = 0;
		for (int i = 0; i < array3.length; i++) {
			for (int j = 0; j < array3.length; j++) {
				System.out.print(array3[i][j]+" ");
				count++;
			}
			if (count%5==0) {
				System.out.println();
			}
		}
		
				
		
	}
}